<?php


header("Content-type:text/html;charset=utf-8");
/** 赢彩网 开奖结果出来后  投注结算 **/
set_time_limit(0);
date_default_timezone_set("PRC");
include('./db_config.php');

//1.连接数据库->pdo方式
$db_pdo_link = pdo_write_read_link();  //定义为全局变量

if(!$db_pdo_link)
{
	die('pdo connection failed!');
}

$OPENTIME=TIME();

//取出未结算的投注注单  每次循环最多执行3000条 
$ALL_WEIJS=$db_pdo_link->query("SELECT * FROM kkty_touzhu_list_no where czid=62 limit 3000")->fetchAll(PDO::FETCH_ASSOC);

FOREACH($ALL_WEIJS  AS $TZ){   
	 
	 $QKJJG=$db_pdo_link->query("SELECT * FROM kkty_kjjg_list WHERE czid={$TZ['czid']} AND qihao='".$TZ['qihao']."'")->fetch(PDO::FETCH_ASSOC);

	 IF($QKJJG['kjjg']>0){

		 $SSC_ARRAY = ['62'];  //【重庆(赢彩)时时彩,天津时时彩】	 
		 
		 //时时彩
		 IF(in_array($TZ['czid'],$SSC_ARRAY))
		 { 
			 $vip_account_result = SSC_TOUZHUJIESUAN($TZ['id'],$QKJJG['kjjg']);
			 
		 }

		 //用户正常结算后再结算有代理的情况	
		 if($vip_account_result)
		 {
			 DAILIJIESUAN($TZ['username'],$TZ['tzje']-$TZ['fdje'],$TZ['qihao'],$TZ['czid']);
		 }
		 
		 
	 }
	 
	 
}


// 建立时时彩投注注单结算公共类 【已和前台玩法对比 无问题】

//-------------------------------------------时时彩彩种类结算----------------------------------------------------------//

FUNCTION SSC_TOUZHUJIESUAN($TZID,$KJJG){
	 
	 GLOBAL $db_pdo_link;
	 
	 $OLD_TZ=$db_pdo_link->query("SELECT * FROM kkty_touzhu_list_no WHERE id={$TZID}")->fetch(PDO::FETCH_ASSOC);

	 IF($OLD_TZ['wfid']>0){
		 
		 $wanfaname = $db_pdo_link->query("SELECT * FROM kkty_play_classify where id={$OLD_TZ['wfid']}")->fetch(PDO::FETCH_ASSOC);

	 }ELSE{
		 
		 $wanfaname=$db_pdo_link->query("SELECT * FROM kkty_peilv WHERE wanfa='".$OLD_TZ['tzhm']."'")->fetch(PDO::FETCH_ASSOC);
		 
	 }
	 
	 $KJJG_1=SUBSTR($KJJG,0,1);
	 
	 $KJJG_2=SUBSTR($KJJG,1,1);
	 
	 $KJJG_3=SUBSTR($KJJG,2,1);
	 
	 $KJJG_4=SUBSTR($KJJG,3,1);
	 
	 $KJJG_5=SUBSTR($KJJG,4,1);
	 
	 $ZJZS=0;
	 
	 $ZJJE=0;

	 IF($wanfaname['class_name_mini']=="五星直选复式"){
		 
		 $HMARAY=explode(",",$OLD_TZ['tzhm']);
		 
		 IF(COUNT($HMARAY)==5){
			 
			 IF(STRSTR($HMARAY[0],$KJJG_1) !== false){
				 
				 IF(STRSTR($HMARAY[1],$KJJG_2) !== false){
					 
					 IF(STRSTR($HMARAY[2],$KJJG_3) !== false){
						 
						 IF(STRSTR($HMARAY[3],$KJJG_4) !== false){
							 
							 IF(STRSTR($HMARAY[4],$KJJG_5) !== false){
								 
								 $ZJZS=$ZJZS+1;
								 
							 }
							 
						 }
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 if($wanfaname['class_name_mini']=="五星直选组合"){
	 	
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	
	 	if(strstr($HMARAY[4], $KJJG_5) !== false){
	 		$ZJZS=$ZJZS+1;
	 		if(strstr($HMARAY[3], $KJJG_4) !== false){
	 			$ZJZS=$ZJZS+1;
	 			if(strstr($HMARAY[2], $KJJG_3) !== false){
	 				$ZJZS=$ZJZS+1;
	 				if(strstr($HMARAY[1], $KJJG_2) !== false){
	 					$ZJZS=$ZJZS+1;
	 					if(strstr($HMARAY[0], $KJJG_1) !== false){
	 						$ZJZS=$ZJZS+1;
	 					}
	 				}
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "五星组选120"){
	 	
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	
	 	$arr_count = array_count_values($HMARAY);
	 	
	 	rsort($arr_count);
	 	
	 	if($arr_count[0]<=1){
	 		
	 		if(strstr($OLD_TZ['tzhm'], $KJJG_1) !== false){
	 			
	 			if(strstr($OLD_TZ['tzhm'], $KJJG_2) !== false){
	 				
	 				if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 					
	 					if(strstr($OLD_TZ['tzhm'], $KJJG_4) !== false){
	 						
	 						if(strstr($OLD_TZ['tzhm'], $KJJG_5) !== false){
	 							
	 							$ZJZS = $ZJZS+1;
	 						}
	 					}
	 				}
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "五星组选60"){
	 	 
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 	
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 	
	 	$kjjg_arr = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
	 	
	 	$arr_count = array_count_values($kjjg_arr);
	 	
	 	rsort($arr_count);
	 	
	 	$cfkjjg = 0;
	 	
	 	$kk = array();
	 	
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$cfkjjg = $k;
	 		}else{
	 			$kk[] = $k;
	 		}
	 	}

	 	if($arr_count[0]==2){

	 		if(in_array($cfkjjg,$HMARAY_A) !== false){

	 			if(in_array($kk[0],$HMARAY_B) !== false){

	 				if(in_array($kk[1],$HMARAY_B) !== false){
	 	
	 					if(in_array($kk[2],$HMARAY_B) !== false){
	 		
	 							$ZJZS = $ZJZS+1;

	 					}
	 				}
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "五星组选30"){
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 	
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 	
	 	$kjjg_arr = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
	 	 
	 	$arr_count = array_count_values($kjjg_arr);
	 	 
	 	rsort($arr_count);
	 	 
	 	$cfkjjg = 0;
	 	 
	 	$kk = array();
	 	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$kk[] = $k;
	 		}else{
	 			$cfkjjg = $k;
	 		}
	 	}
	 	
	 	if($arr_count[0]==2 && $arr_count[1]==2){
	 	
	 		if(in_array($cfkjjg,$HMARAY_B) !== false){
	 	
	 			if(in_array($kk[0],$HMARAY_A) !== false){
	 	
	 				if(in_array($kk[1],$HMARAY_A) !== false){
	 	
	 						$ZJZS = $ZJZS+1;
	 	
	 				}
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "五星组选20"){
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	 
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 	 
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 	 
	 	$kjjg_arr = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
	 	 
	 	$arr_count = array_count_values($kjjg_arr);
	 	 
	 	rsort($arr_count);
	 	 
	 	$cfkjjg = 0;
	 	 
	 	$kk = array();
	 	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$cfkjjg = $k;
	 		}else{
	 			$kk[] = $k;
	 		}
	 	}
	 	
	 	if($arr_count[0]==3){
	 	
	 		if(in_array($cfkjjg,$HMARAY_A) !== false){
	 	
	 			if(in_array($kk[0],$HMARAY_B) !== false){
	 	
	 				if(in_array($kk[1],$HMARAY_B) !== false){
	 	
	 						$ZJZS = $ZJZS+1;

	 				}
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "五星组选10"){
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 
	 	$kjjg_arr = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
	 
	 	$arr_count = array_count_values($kjjg_arr);
	 
	 	rsort($arr_count);
	 
	 	$cfkjjg = 0;
	 
	 	$kk = 0;
	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$cfkjjg = $k;
	 		}else{
	 			$kk = $k;
	 		}
	 	}
	 	 
	 	if($arr_count[0]==3 && $arr_count[1]==2){
	 		 
	 		if(in_array($cfkjjg,$HMARAY_A) !== false){
	 			 
	 			if(in_array($kk,$HMARAY_B) !== false){
	 					 
	 					$ZJZS = $ZJZS+1;
	 
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "五星组选5"){
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 
	 	$kjjg_arr = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
	 
	 	$arr_count = array_count_values($kjjg_arr);
	 
	 	rsort($arr_count);
	 
	 	$cfkjjg = 0;
	 
	 	$kk = 0;
	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$cfkjjg = $k;
	 		}else{
	 			$kk = $k;
	 		}
	 	}
	 	 
	 	if($arr_count[0]==4){
	 		 
	 		if(in_array($cfkjjg,$HMARAY_A) !== false){
	 			 
	 			if(in_array($kk[0],$HMARAY_B) !== false){
	 				
	 					$ZJZS = $ZJZS+1;
	 
	 			}
	 		}
	 	}
	 }
	 
	 IF($wanfaname['class_name_mini']=="前四直选复式"){
		 
		 $HMARAY=explode(",",$OLD_TZ['tzhm']);
		 
		 IF(COUNT($HMARAY)==4){
			 
			 IF(STRSTR($HMARAY[0],$KJJG_1) !== false){
				 
				 IF(STRSTR($HMARAY[1],$KJJG_2) !== false){
					 
					 IF(STRSTR($HMARAY[2],$KJJG_3) !== false){
						 
						 IF(STRSTR($HMARAY[3],$KJJG_4) !== false){
						
							 $ZJZS=$ZJZS+1;
							 
						 }
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 if($wanfaname['class_name_mini']=="前四直选组合"){
	 	 
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);

 		if(strstr($HMARAY[3], $KJJG_5) !== false){
 			$ZJZS=$ZJZS+1;
 			if(strstr($HMARAY[2], $KJJG_4) !== false){
 				$ZJZS=$ZJZS+1;
 				if(strstr($HMARAY[1], $KJJG_3) !== false){
 					$ZJZS=$ZJZS+1;
 					if(strstr($HMARAY[0], $KJJG_2) !== false){
 						$ZJZS=$ZJZS+1;
 					}
 				}
 			}
 		}
	 	
	 }
	 if($wanfaname['class_name_mini']=="后四直选组合"){
	 
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);

 		if(strstr($HMARAY[3], $KJJG_4) !== false){
 			$ZJZS=$ZJZS+1;
 			if(strstr($HMARAY[2], $KJJG_3) !== false){
 				$ZJZS=$ZJZS+1;
 				if(strstr($HMARAY[1], $KJJG_2) !== false){
 					$ZJZS=$ZJZS+1;
 					if(strstr($HMARAY[0], $KJJG_1) !== false){
 						$ZJZS=$ZJZS+1;
 					}
 				}
 			}
 		}
	 }
	 if($wanfaname['class_name_mini'] == "前四星组选24"){
	 	 
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	 
	 	$arr_count = array_count_values($HMARAY);
	 	 
	 	rsort($arr_count);
	 	 
	 	if($arr_count[0]<=1){
	 
	 		if(strstr($OLD_TZ['tzhm'], $KJJG_1) !== false){
	 				
	 			if(strstr($OLD_TZ['tzhm'], $KJJG_2) !== false){
	 
	 				if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 						
	 					if(strstr($OLD_TZ['tzhm'], $KJJG_4) !== false){
	 								
	 							$ZJZS = $ZJZS+1;
	 						}
	 					}
	 				}
	 			}
	 		}
	 	}
	 
	 if($wanfaname['class_name_mini'] == "前四星组选12"){
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 
	 	$kjjg_arr = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4);
	 
	 	$arr_count = array_count_values($kjjg_arr);
	 
	 	rsort($arr_count);
	 
	 	$cfkjjg = 0;
	 
	 	$kk = array();
	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$cfkjjg = $k;
	 		}else{
	 			$kk[] = $k;
	 		}
	 	}
	 	 
	 	if($arr_count[0]==2){
	 		 
	 		if(in_array($cfkjjg,$HMARAY_A) !== false){
	 			 
	 			if(in_array($kk[0],$HMARAY_B) !== false){
	 				 
	 				if(in_array($kk[1],$HMARAY_B) !== false){
	 					 
	 					$ZJZS = $ZJZS+1;
	 
	 				}
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "前四星组选6"){

	 	$HMARAY = explode(' ', $HMARAY[0]);
	 
	 	$kjjg_arr = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4);
	 
	 	$arr_count = array_count_values($kjjg_arr);
	 
	 	rsort($arr_count);
	 
	 	$kk = array();
	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$kk[] = $k;
	 		}
	 	}
	 
	 	if($arr_count[0]==2 && $arr_count[1]==2){
	 
 			if(in_array($kk[0],$HMARAY) !== false){
 					
 				if(in_array($kk[1],$HMARAY) !== false){
 
 					$ZJZS = $ZJZS+1;
 
 				}
 			}
	 		
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "前四星组选4"){
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 
	 	$kjjg_arr = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4);
	 
	 	$arr_count = array_count_values($kjjg_arr);
	 
	 	rsort($arr_count);
	 
	 	$cfkjjg = 0;
	 
	 	$kk = 0;
	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$cfkjjg = $k;
	 		}else{
	 			$kk = $k;
	 		}
	 	}
	 
	 	if($arr_count[0]==3){
	 	 	
	 		if(in_array($cfkjjg,$HMARAY_A) !== false){
	 
	 			if(in_array($kk,$HMARAY_B) !== false){
 
	 					$ZJZS = $ZJZS+1;

	 			}
	 		}
	 	}
	 }
	 IF($wanfaname['class_name_mini']=="后四直选复式"){
		 
		 $HMARAY=explode(",",$OLD_TZ['tzhm']);
		 
		 IF(COUNT($HMARAY)==4){
			 
			 IF(STRSTR($HMARAY[0],$KJJG_2) !== false){
				 
				 IF(STRSTR($HMARAY[1],$KJJG_3) !== false){
					 
					 IF(STRSTR($HMARAY[2],$KJJG_4) !== false){
						 
						 IF(STRSTR($HMARAY[3],$KJJG_5) !== false){
						
							 $ZJZS=$ZJZS+1;
							 
						 }
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 if($wanfaname['class_name_mini'] == "后四星组选24"){
	 
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 
	 	$arr_count = array_count_values($HMARAY);
	 
	 	rsort($arr_count);
	 
	 	if($arr_count[0]<=1){
	 
	 		if(strstr($OLD_TZ['tzhm'], $KJJG_5) !== false){
	 
	 			if(strstr($OLD_TZ['tzhm'], $KJJG_2) !== false){
	 
	 				if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 
	 					if(strstr($OLD_TZ['tzhm'], $KJJG_4) !== false){
	 
	 						$ZJZS = $ZJZS+1;
	 					}
	 				}
	 			}
	 		}
	 	}
	 }
	 
	 if($wanfaname['class_name_mini'] == "前四星组选12"){
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 
	 	$kjjg_arr = array($KJJG_5,$KJJG_2,$KJJG_3,$KJJG_4);
	 
	 	$arr_count = array_count_values($kjjg_arr);
	 
	 	rsort($arr_count);
	 
	 	$cfkjjg = 0;
	 
	 	$kk = array();
	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$cfkjjg = $k;
	 		}else{
	 			$kk[] = $k;
	 		}
	 	}
	 
	 	if($arr_count[0]==2){
	 	 	
	 		if(in_array($cfkjjg,$HMARAY_A) !== false){
	 
	 			if(in_array($kk[0],$HMARAY_B) !== false){
	 					
	 				if(in_array($kk[1],$HMARAY_B) !== false){
	 
	 					$ZJZS = $ZJZS+1;
	 
	 				}
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "前四星组选6"){
	 
	 	$HMARAY = explode(' ', $HMARAY[0]);
	 
	 	$kjjg_arr = array($KJJG_5,$KJJG_2,$KJJG_3,$KJJG_4);
	 
	 	$arr_count = array_count_values($kjjg_arr);
	 
	 	rsort($arr_count);
	 
	 	$kk = array();
	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$kk[] = $k;
	 		}
	 	}
	 
	 	if($arr_count[0]==2 && $arr_count[1]==2){
	 
	 		if(in_array($kk[0],$HMARAY) !== false){
	 
	 			if(in_array($kk[1],$HMARAY) !== false){
	 
	 				$ZJZS = $ZJZS+1;
	 
	 			}
	 		}
	 
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "前四星组选4"){
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 
	 	$kjjg_arr = array($KJJG_5,$KJJG_2,$KJJG_3,$KJJG_4);
	 
	 	$arr_count = array_count_values($kjjg_arr);
	 
	 	rsort($arr_count);
	 
	 	$cfkjjg = 0;
	 
	 	$kk = 0;
	 
	 	foreach (array_count_values($kjjg_arr) as $k => $v){
	 		if($arr_count[0]==$v){
	 			$cfkjjg = $k;
	 		}else{
	 			$kk = $k;
	 		}
	 	}
	 
	 	if($arr_count[0]==3){
	 	 	
	 		if(in_array($cfkjjg,$HMARAY_A) !== false){
	 
	 			if(in_array($kk,$HMARAY_B) !== false){
	 
	 				$ZJZS = $ZJZS+1;
	 
	 			}
	 		}
	 	}
	 }
	 IF($wanfaname['class_name_mini']=="后三直选复式"){
		 
		 $HMARAY=explode(",",$OLD_TZ['tzhm']);
		 
		 IF(COUNT($HMARAY)==3){
			 
			 IF(STRSTR($HMARAY[0],$KJJG_3) !== false){
				 
				 IF(STRSTR($HMARAY[1],$KJJG_4) !== false){
					 
					 IF(STRSTR($HMARAY[2],$KJJG_5) !== false){
					 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 if($wanfaname['class_name_mini']=="后三直选和值"){
	 	
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 	
	 	$cont = $KJJG_3+$KJJG_4+$KJJG_5;
	 	
	 	if(in_array($cont, $HMARAY) !== false){
	 		
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="后三直选跨度"){
	 	
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 	
	 	$arr = array($KJJG_3,$KJJG_4,$KJJG_5);
	 	
	 	$cz = max($arr)-min($arr);
	 	
	 	if(in_array($cz, $HMARAY) !== false){
	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="后三直选和值尾数"){
	 	
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 	
	 	$cont = $KJJG_3+$KJJG_4+$KJJG_5;
	 	
	 	$ws = substr($cont, -1);
	 	
	 	if(in_array($ws, $HMARAY) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 IF($wanfaname['class_name_mini']=="中三直选复式"){
		 
		 $HMARAY=explode(",",$OLD_TZ['tzhm']);
		 
		 IF(COUNT($HMARAY)==3){
			 
			 IF(STRSTR($HMARAY[0],$KJJG_2) !== false){
				 
				 IF(STRSTR($HMARAY[1],$KJJG_3) !== false){
					 
					 IF(STRSTR($HMARAY[2],$KJJG_4) !== false){
					 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 if($wanfaname['class_name_mini']=="中三直选和值"){
	 	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 	 
	 	$cont = $KJJG_3+$KJJG_4+$KJJG_2;
	 	 
	 	if(in_array($cont, $HMARAY) !== false){
	 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="中三直选跨度"){
	 	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 	 
	 	$arr = array($KJJG_3,$KJJG_4,$KJJG_2);
	 	 
	 	$cz = max($arr)-min($arr);
	 	 
	 	if(in_array($cz, $HMARAY) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="中三直选和值尾数"){
	 	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 	 
	 	$cont = $KJJG_3+$KJJG_4+$KJJG_2;
	 	 
	 	$ws = substr($cont, -1);
	 	 
	 	if(in_array($ws, $HMARAY) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 IF($wanfaname['class_name_mini']=="前三直选复式"){
		 
		 $HMARAY=explode(",",$OLD_TZ['tzhm']);
		 
		 IF(COUNT($HMARAY)==3){
			 
			 IF(STRSTR($HMARAY[0],$KJJG_1) !== false){
				 
				 IF(STRSTR($HMARAY[1],$KJJG_2) !== false){
					 
					 IF(STRSTR($HMARAY[2],$KJJG_3) !== false){
					 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 if($wanfaname['class_name_mini']=="前三直选和值"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	$cont = $KJJG_3+$KJJG_1+$KJJG_2;
	 
	 	if(in_array($cont, $HMARAY) !== false){
	 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="前三直选跨度"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	$arr = array($KJJG_3,$KJJG_1,$KJJG_2);
	 
	 	$cz = max($arr)-min($arr);
	 
	 	if(in_array($cz, $HMARAY) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="前三直选和值尾数"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	$cont = $KJJG_3+$KJJG_1+$KJJG_2;
	 
	 	$ws = substr($cont, -1);
	 
	 	if(in_array($ws, $HMARAY) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 IF($wanfaname['class_name_mini']=="后三组选组六"){
		 
		 IF($KJJG_3!=$KJJG_4 && $KJJG_3!=$KJJG_5 && $KJJG_4!=$KJJG_5){
			 
			 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_3) !== false){
				 
				 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_4) !== false){
					 
					 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_5) !== false){
						 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 IF($wanfaname['class_name_mini']=="中三组选组六"){
		 
		 IF($KJJG_3!=$KJJG_2 && $KJJG_3!=$KJJG_4 && $KJJG_4!=$KJJG_2){
			 
			 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_2) !== false){
				 
				 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_3) !== false){
					 
					 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_4) !== false){
						 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 IF($wanfaname['class_name_mini']=="前三组选组六"){
		 
		 IF($KJJG_1!=$KJJG_2 && $KJJG_3!=$KJJG_1 && $KJJG_3!=$KJJG_2){
			 
			 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_1) !== false){
				 
				 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_2) !== false){
					 
					 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_3) !== false){
						 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 
	 IF($wanfaname['class_name_mini']=="后三组选组三"){
		 
		 $IFZS="0";
		 
		 IF($KJJG_3==$KJJG_4 && $KJJG_3!=$KJJG_5 && $KJJG_4!=$KJJG_5){$IFZS="1";}
		 
		 IF($KJJG_3==$KJJG_5 && $KJJG_3!=$KJJG_4 && $KJJG_4!=$KJJG_5){$IFZS="1";}
		 
		 IF($KJJG_5==$KJJG_4 && $KJJG_3!=$KJJG_4 && $KJJG_3!=$KJJG_5){$IFZS="1";}
		 
		 IF($IFZS=="1"){
			 
			 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_3) !== false){
				 
				 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_4) !== false){
					 
					 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_5) !== false){
						 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 
	 IF($wanfaname['class_name_mini']=="中三组选组三"){
		 
		 $IFZS="0";
		 
		 IF($KJJG_3==$KJJG_2 && $KJJG_3!=$KJJG_4 && $KJJG_4!=$KJJG_2){$IFZS="1";}
		 
		 IF($KJJG_3==$KJJG_4 && $KJJG_2!=$KJJG_4 && $KJJG_2!=$KJJG_3){$IFZS="1";}
		 
		 IF($KJJG_2==$KJJG_4 && $KJJG_3!=$KJJG_4 && $KJJG_3!=$KJJG_2){$IFZS="1";}
		 
		 IF($IFZS=="1"){
			 
			 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_2) !== false){
				 
				 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_3) !== false){
					 
					 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_4) !== false){
						 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 
	 IF($wanfaname['class_name_mini']=="前三组选组三"){
		 
		 $IFZS="0";
		 
		 IF($KJJG_1==$KJJG_2 && $KJJG_3!=$KJJG_1 && $KJJG_3!=$KJJG_2){$IFZS="1";}
		 
		 IF($KJJG_1==$KJJG_3 && $KJJG_2!=$KJJG_1 && $KJJG_2!=$KJJG_3){$IFZS="1";}
		 
		 IF($KJJG_2==$KJJG_3 && $KJJG_3!=$KJJG_1 && $KJJG_1!=$KJJG_2){$IFZS="1";}
		 
		 IF($IFZS=="1"){
			 
			 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_1) !== false){
				 
				 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_2) !== false){
					 
					 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_3) !== false){
						 
						 $ZJZS=$ZJZS+1;
						 
					 }
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 
	 IF($wanfaname['class_name_mini']=="后二直选复式"){
		 
		 $HMARAY=explode(",",$OLD_TZ['tzhm']);
		 
		 IF(COUNT($HMARAY)==2){
			 
			 IF(STRSTR($HMARAY[0],$KJJG_4) !== false){
				 
				 IF(STRSTR($HMARAY[1],$KJJG_5) !== false){
				 
					 $ZJZS=$ZJZS+1;
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	if($wanfaname['class_name_mini']=="后二直选和值"){
	 	
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	
	 	$cont = $KJJG_4+$KJJG_5;
	 	
	 	if(in_array($cont, $HMARAY) !== false){
	 		
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="后二直选跨度"){
	 	
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	
	 	$arr = array($KJJG_4,$KJJG_5);
	 	
	 	$cz = max($arr)-min($arr);
	 	
	 	if(in_array($cz, $HMARAY) !== false){
	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="后二直选和值尾数"){
	 	
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	
	 	$cont = $KJJG_4+$KJJG_5;
	 	
	 	$ws = substr($cont, -1);
	 	
	 	if(in_array($ws, $HMARAY) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 IF($wanfaname['class_name_mini']=="前二直选复式"){
		 
		 $HMARAY=explode(",",$OLD_TZ['tzhm']);
		 
		 IF(COUNT($HMARAY)==2){
			 
			 IF(STRSTR($HMARAY[0],$KJJG_1) !== false){
				 
				 IF(STRSTR($HMARAY[1],$KJJG_2) !== false){
				 
					 $ZJZS=$ZJZS+1;
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 IF($wanfaname['class_name_mini']=="后二组选复式"){
	 		
	 	IF($KJJG_4!=$KJJG_5){
	 
	 		IF(STRSTR($OLD_TZ['tzhm'],$KJJG_4) !== false){
	 				
	 			IF(STRSTR($OLD_TZ['tzhm'],$KJJG_5) !== false){
	 					
	 				$ZJZS=$ZJZS+1;
	 
	 			}
	 				
	 		}
	 
	 	}
	 		
	 }
	 if($wanfaname['class_name_mini']=="前二直选和值"){
	 	 
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	 
	 	$cont = $KJJG_1+$KJJG_2;
	 	 
	 	if(in_array($cont, $HMARAY) !== false){
	 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="前二直选跨度"){
	 	 
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	 
	 	$arr = array($KJJG_1,$KJJG_2);
	 	 
	 	$cz = max($arr)-min($arr);
	 	 
	 	if(in_array($cz, $HMARAY) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="前二直选和值尾数"){
	 	 
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	 
	 	$cont = $KJJG_1+$KJJG_2;
	 	 
	 	$ws = substr($cont, -1);
	 	 
	 	if(in_array($ws, $HMARAY) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 
	 
	 IF($wanfaname['class_name_mini']=="前二组选复式"){
		 
		 IF($KJJG_1!=$KJJG_2){
			 
			 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_1) !== false){
				 
				 IF(STRSTR($OLD_TZ['tzhm'],$KJJG_2) !== false){
				 
					 $ZJZS=$ZJZS+1;
					 
				 }
				 
			 }
			 
		 }
		 
	 }
	 
	 if($wanfaname['class_name_mini'] == "定位胆"){
	 	
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	
	 	if(strstr($HMARAY[0], $KJJG_1)!==false){
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($HMARAY[1], $KJJG_2)!==false){
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($HMARAY[2], $KJJG_3)!==false){
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($HMARAY[3], $KJJG_4)!==false){
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($HMARAY[4], $KJJG_5)!==false){
	 		$ZJZS=$ZJZS+1;
	 	}
	 	
	 }
	 
	 if($wanfaname['class_name_mini']=="三星不定位后三一码"){

	 	if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 		
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_4) !== false){
	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_5) !== false){
	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 
	 if($wanfaname['class_name_mini']=="三星不定位中三一码"){
	 
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_4) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_2) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 
	 if($wanfaname['class_name_mini']=="三星不定位前三一码"){
	 
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_2) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_1) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 
	 if($wanfaname['class_name_mini']=="三星不定位后三二码"){
	 	
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 		
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 	
	 		if(in_array($KJJG_5,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_5, $HMARAY) !== false){
	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	
	 }
	 if($wanfaname['class_name_mini']=="三星不定位中三二码"){
	 	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 		 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 		 
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	 
	 }
	 if($wanfaname['class_name_mini']=="三星不定位前三二码"){
	 	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 
	 		if(in_array($KJJG_1,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 		 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 		 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	 
	 }
	 if($wanfaname['class_name_mini'] == "四星不定位前四一码"){
	 	
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_4) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 	
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_2) !== false){
	 			
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_1) !== false){
	 			
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="四星不定位前四二码"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 	
	 		if(in_array($KJJG_3,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 
	 }
	 if($wanfaname['class_name_mini']=="四星不定位后四二码"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_5, $HMARAY) !== false){
	 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_5, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_5, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 		 
	 		if(in_array($KJJG_3,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 
	 }
	 if($wanfaname['class_name_mini']=="四星不定位前四三码"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}

	 
	 }
	 if($wanfaname['class_name_mini']=="四星不定位后四三码"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_5, $HMARAY) !== false){
	 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 				
	 			if(in_array($KJJG_4,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_5, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 				
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 				
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 
	 
	 }
	 if($wanfaname['class_name_mini'] == "四星不定位后四一码"){
	 	 
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_4) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 	 
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 		 
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_2) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_5) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "五星不定位五星一码"){
	 	
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_1) !== false){
	 			
	 		$ZJZS=$ZJZS+1;
	 	}
	 
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_4) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_3) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_2) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 	if(strstr($OLD_TZ['tzhm'], $KJJG_5) !== false){
	 	 	
	 		$ZJZS=$ZJZS+1;
	 	}
	 }
	 if($wanfaname['class_name_mini']=="五星不定位五星二码"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_5,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 		 
	 		if(in_array($KJJG_3,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_5,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			 
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_5,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if(in_array($KJJG_5, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 
	 }
	 
	 if($wanfaname['class_name_mini']=="五星不定位五星三码"){
	 
	 	$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	 
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_4,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_5,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_3,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_4,$HMARAY) !== false){
	 			 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_3,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_5,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_5,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_5,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 			 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_5,$HMARAY) !== false){
	 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_3, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_5,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_4,$HMARAY) !== false){
	 			 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_2, $HMARAY) !== false){
	 	 	
	 		if(in_array($KJJG_4,$HMARAY) !== false){
	 			
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 			 
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 
	 }
	 if($wanfaname['class_name_mini'] == "五星不定位五星四码"){
	 	
	 	$OLD=explode(" ",$OLD_TZ['tzhm']);
	 	
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 		 	
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 				
	 				if(in_array($KJJG_4,$HMARAY) !== false){
	 	
	 					$ZJZS=$ZJZS+1;
	 				}
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 	
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 	
	 				if(in_array($KJJG_5,$HMARAY) !== false){
	 					 
	 					$ZJZS=$ZJZS+1;
	 				}
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_5, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 	
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 	
	 				if(in_array($KJJG_4,$HMARAY) !== false){
	 					 
	 					$ZJZS=$ZJZS+1;
	 				}
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_5,$HMARAY) !== false){
	 	
	 			if(in_array($KJJG_3,$HMARAY) !== false){
	 	
	 				if(in_array($KJJG_4,$HMARAY) !== false){
	 					 
	 					$ZJZS=$ZJZS+1;
	 				}
	 			}
	 		}
	 	}
	 	if(in_array($KJJG_1, $HMARAY) !== false){
	 			
	 		if(in_array($KJJG_2,$HMARAY) !== false){
	 	
	 			if(in_array($KJJG_5,$HMARAY) !== false){
	 	
	 				if(in_array($KJJG_4,$HMARAY) !== false){
	 					 
	 					$ZJZS=$ZJZS+1;
	 				}
	 			}
	 		}
	 	}
	 }
	
	 if($wanfaname['class_name_mini']=="任二复式"){

	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 		
	 	$RENYISAN=0;
	 		
	 	IF(COUNT($HMARAY)==5){
	 	
	 		IF(STRSTR($HMARAY[0],$KJJG_1) !== false){
	 				
	 			$RENYISAN=$RENYISAN+1;
	 				
	 		}
	 		IF(STRSTR($HMARAY[1],$KJJG_2) !== false){
	 				
	 			$RENYISAN=$RENYISAN+1;
	 				
	 		}
	 		IF(STRSTR($HMARAY[2],$KJJG_3) !== false){
	 				
	 			$RENYISAN=$RENYISAN+1;
	 				
	 		}
	 		IF(STRSTR($HMARAY[3],$KJJG_4) !== false){
	 				
	 			$RENYISAN=$RENYISAN+1;
	 				
	 		}
	 		IF(STRSTR($HMARAY[4],$KJJG_5) !== false){
	 				
	 			$RENYISAN=$RENYISAN+1;
	 				
	 		}
	 	
	 		IF($RENYISAN==2){$ZJZS=1;}
	 		IF($RENYISAN==3){$ZJZS=3;}
	 		IF($RENYISAN==4){$ZJZS=6;}
	 		IF($RENYISAN==5){$ZJZS=10;}
	 	
	 	}
	 }

	 if($wanfaname['class_name_mini'] == "任二组选"){
	 	
	 	$HMARAY=explode(",",$OLD_TZ['tzhm']);
	 	$HMARAY_A = explode(' ', $HMARAY[0]);
	 	$HMARAY_B = explode(' ', $HMARAY[1]);
	 	$RENYISAN=0;
	 	$arr = array(
	 		'万位'=>$KJJG_1,'千位'=>$KJJG_2,'百位'=>$KJJG_3,'十位'=>$KJJG_4,'个位'=>$KJJG_5
	 	);
	 	for ($i=0;$i<count($HMARAY_A);$i++){
	 		foreach ($arr as $key=>$value){
	 			if($HMARAY_A[$i]==$key){
	 				if(count($HMARAY_B)>=2){
	 					IF(STRSTR($HMARAY[1],$value) !== false){
	 					 	
	 						$RENYISAN=$RENYISAN+1;
	 				
	 					}
	 				}
	 			}
	 		}
	 		
	 	}
	 	IF($RENYISAN==2){$ZJZS=1;}
	 	IF($RENYISAN==3){$ZJZS=3;}
	 	IF($RENYISAN==4){$ZJZS=6;}
	 	IF($RENYISAN==5){$ZJZS=10;}
	 	
	 }

	if($wanfaname['class_name_mini'] == "任三复式"){
		$HMARAY=explode(",",$OLD_TZ['tzhm']);
			
		$RENYISAN=0;
			
		IF(COUNT($HMARAY)==5){
		
			IF(STRSTR($HMARAY[0],$KJJG_1) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
			IF(STRSTR($HMARAY[1],$KJJG_2) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
			IF(STRSTR($HMARAY[2],$KJJG_3) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
			IF(STRSTR($HMARAY[3],$KJJG_4) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
			IF(STRSTR($HMARAY[4],$KJJG_5) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
		
			IF($RENYISAN==3){$ZJZS=1;}
			IF($RENYISAN==4){$ZJZS=4;}
			IF($RENYISAN==5){$ZJZS=10;}
		
		}
	}
	//哈哈哈哈没有写出来的
	if($wanfaname['class_name_mini'] == "任三组三"){
		$HMARAY=explode(",",$OLD_TZ['tzhm']);
		$HMARAY_A = array_filter(explode(' ', $HMARAY[0]));
		
		$HMARAY_B = explode(' ', $HMARAY[1]);
		 $arr  = array(
			0=>array('万位'=>$KJJG_1,'千位'=>$KJJG_2,'百位'=>$KJJG_3),
		    1=>array('万位'=>$KJJG_1,'千位'=>$KJJG_2,'十位'=>$KJJG_4),
		    2=>array('万位'=>$KJJG_1,'千位'=>$KJJG_2,'个位'=>$KJJG_5),
		    3=>array('万位'=>$KJJG_1,'百位'=>$KJJG_3,'十位'=>$KJJG_4),
		    4=>array('万位'=>$KJJG_1,'百位'=>$KJJG_3,'个位'=>$KJJG_5),
		    5=>array('万位'=>$KJJG_1,'十位'=>$KJJG_4,'个位'=>$KJJG_5),
		    6=>array('千位'=>$KJJG_2,'百位'=>$KJJG_3,'十位'=>$KJJG_4),
		    7=>array('千位'=>$KJJG_2,'百位'=>$KJJG_3,'个位'=>$KJJG_5),
		    8=>array('千位'=>$KJJG_2,'十位'=>$KJJG_4,'个位'=>$KJJG_5),
		    9=>array('百位'=>$KJJG_3,'十位'=>$KJJG_4,'个位'=>$KJJG_5)
		);
		foreach($arr as $v) {
            $position = array_keys($v);
            $con = array_intersect($position,$HMARAY_A);
            sort($con);
            sort($position);
            if($position == $con) {
                if(count(array_intersect($HMARAY_B,$v)) == 2) {
                    $ZJZS = $ZJZS+1;
                }
            }
        }
	}
	if($wanfaname['class_name_mini'] == "任三组六"){
		$HMARAY=explode(",",$OLD_TZ['tzhm']);
		$HMARAY_A = array_filter(explode(' ', $HMARAY[0]));
		
		$HMARAY_B = explode(' ', $HMARAY[1]);
		$arr  = array(
			0=>array('万位'=>$KJJG_1,'千位'=>$KJJG_2,'百位'=>$KJJG_3),
		    1=>array('万位'=>$KJJG_1,'千位'=>$KJJG_2,'十位'=>$KJJG_4),
		    2=>array('万位'=>$KJJG_1,'千位'=>$KJJG_2,'个位'=>$KJJG_5),
		    3=>array('万位'=>$KJJG_1,'百位'=>$KJJG_3,'十位'=>$KJJG_4),
		    4=>array('万位'=>$KJJG_1,'百位'=>$KJJG_3,'个位'=>$KJJG_5),
		    5=>array('万位'=>$KJJG_1,'十位'=>$KJJG_4,'个位'=>$KJJG_5),
		    6=>array('千位'=>$KJJG_2,'百位'=>$KJJG_3,'十位'=>$KJJG_4),
		    7=>array('千位'=>$KJJG_2,'百位'=>$KJJG_3,'个位'=>$KJJG_5),
		    8=>array('千位'=>$KJJG_2,'十位'=>$KJJG_4,'个位'=>$KJJG_5),
		    9=>array('百位'=>$KJJG_3,'十位'=>$KJJG_4,'个位'=>$KJJG_5)
		);
		foreach($arr as $v) {
            $position = array_keys($v);
            $con = array_intersect($position,$HMARAY_A);
            sort($con);
            sort($position);
            if($position == $con) {
                if(count(array_intersect($HMARAY_B,$v)) == 3) {
                    $ZJZS = $ZJZS+1;
                }
            }
        }
	} 
	//哈哈哈哈没有写出来的
	if($wanfaname['class_name_mini'] == "任四复式"){
		$HMARAY=explode(",",$OLD_TZ['tzhm']);
			
		$RENYISAN=0;
			
		IF(COUNT($HMARAY)==5){
		
			IF(STRSTR($HMARAY[0],$KJJG_1) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
			IF(STRSTR($HMARAY[1],$KJJG_2) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
			IF(STRSTR($HMARAY[2],$KJJG_3) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
			IF(STRSTR($HMARAY[3],$KJJG_4) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
			IF(STRSTR($HMARAY[4],$KJJG_5) !== false){
					
				$RENYISAN=$RENYISAN+1;
					
			}
		
			IF($RENYISAN==4){$ZJZS=1;}
			IF($RENYISAN==5){$ZJZS=5;}
		
		}
	}
	 
	if($wanfaname['class_name_mini'] == "趣味一帆风顺"){
		$HMARAY=explode(" ",$OLD_TZ['tzhm']);

		$kjjg = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
		
		$vare = array_count_values($kjjg);
		foreach ($vare as $k=>$v){
			IF(in_array($k,$HMARAY)){
			
				$ZJZS=$ZJZS+1;
			
			}
		}
		
	}
	if($wanfaname['class_name_mini'] == "趣味好事成双"){
		$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	
		$kjjg = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
	
		$vare = array_count_values($kjjg);
		foreach ($vare as $k=>$v){
			if ($v==2) {
				if(in_array($k,$HMARAY)){
						
					$ZJZS=$ZJZS+1;
						
				}
			}
			
		}
	}
	if($wanfaname['class_name_mini'] == "趣味三星报喜"){
		$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	
		$kjjg = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
	
		$vare = array_count_values($kjjg);
		foreach ($vare as $k=>$v){
			if ($v==3) {
				if(in_array($k,$HMARAY)){
	
					$ZJZS=$ZJZS+1;
	
				}
			}
				
		}
	}
	if($wanfaname['class_name_mini'] == "趣味四季发财"){
		$HMARAY=explode(" ",$OLD_TZ['tzhm']);
	
		$kjjg = array($KJJG_1,$KJJG_2,$KJJG_3,$KJJG_4,$KJJG_5);
	
		$vare = array_count_values($kjjg);
		foreach ($vare as $k=>$v){
			if ($v==4) {
				if(in_array($k,$HMARAY)){
	
					$ZJZS=$ZJZS+1;
	
				}
			}
	
		}
	}

	 
	 IF($wanfaname['class_name_mini']=="龙虎万个"){
		 
		 IF($OLD_TZ['tzhm']=="龙" && $KJJG_1>$KJJG_5){$ZJZS=$ZJZS+1;}
		 
		 IF($OLD_TZ['tzhm']=="虎" && $KJJG_1<$KJJG_5){$ZJZS=$ZJZS+1;}
		 
		 IF($OLD_TZ['tzhm']=="和" && $KJJG_1==$KJJG_5){$ZJZS=$ZJZS+1;}
		 
	 }
	 IF($wanfaname['class_name_mini']=="龙虎万千"){
	 		
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_1>$KJJG_2){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_1<$KJJG_2){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_1==$KJJG_2){$ZJZS=$ZJZS+1;}
	 		
	 }
	 IF($wanfaname['class_name_mini']=="龙虎万百"){
	 		
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_1>$KJJG_3){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_1<$KJJG_3){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_1==$KJJG_3){$ZJZS=$ZJZS+1;}
	
	 }
	 IF($wanfaname['class_name_mini']=="龙虎万十"){
	 		
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_1>$KJJG_4){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_1<$KJJG_4){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_1==$KJJG_4){$ZJZS=$ZJZS+1;}
	 		
	 }
	 IF($wanfaname['class_name_mini']=="龙虎千百"){
	 		
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_2>$KJJG_3){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_2<$KJJG_3){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_2==$KJJG_3){$ZJZS=$ZJZS+1;}
	 }
	 IF($wanfaname['class_name_mini']=="龙虎千十"){
	 		
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_2>$KJJG_4){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_2<$KJJG_4){$ZJZS=$ZJZS+1;}
	 		
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_2==$KJJG_4){$ZJZS=$ZJZS+1;}
	 }
	 IF($wanfaname['class_name_mini']=="龙虎千个"){
	 
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_2>$KJJG_5){$ZJZS=$ZJZS+1;}
	 
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_2<$KJJG_5){$ZJZS=$ZJZS+1;}
	 
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_2==$KJJG_5){$ZJZS=$ZJZS+1;}
	 }
	 IF($wanfaname['class_name_mini']=="龙虎百十"){
	 
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_3>$KJJG_4){$ZJZS=$ZJZS+1;}
	 
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_3<$KJJG_4){$ZJZS=$ZJZS+1;}
	 
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_3==$KJJG_4){$ZJZS=$ZJZS+1;}
	 }
	 IF($wanfaname['class_name_mini']=="龙虎百个"){
	 
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_3>$KJJG_5){$ZJZS=$ZJZS+1;}
	 
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_3<$KJJG_5){$ZJZS=$ZJZS+1;}
	 
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_3==$KJJG_5){$ZJZS=$ZJZS+1;}
	 }
	 IF($wanfaname['class_name_mini']=="龙虎十个"){
	 
	 	IF($OLD_TZ['tzhm']=="龙" && $KJJG_4>$KJJG_5){$ZJZS=$ZJZS+1;}
	 
	 	IF($OLD_TZ['tzhm']=="虎" && $KJJG_4<$KJJG_5){$ZJZS=$ZJZS+1;}
	 
	 	IF($OLD_TZ['tzhm']=="和" && $KJJG_4==$KJJG_5){$ZJZS=$ZJZS+1;}
	 }
	 if($wanfaname['class_name_mini'] == "特殊号前三"){
	 	
	 	if($OLD_TZ['tzhm']=='对子'){
	 		if($KJJG_1 == $KJJG_2 || $KJJG_1 == $KJJG_3 || $KJJG_2 == $KJJG_3){
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='豹子'){
	 		if($KJJG_1 == $KJJG_2 && $KJJG_1 == $KJJG_3 && $KJJG_2 == $KJJG_3){
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='顺子'){
	 		$arr = array($KJJG_1,$KJJG_2,$KJJG_3);
	 		sort($arr);
	 		if($arr[2]-$arr[1]==1){
	 			if ($arr[1]-$arr[0]==1) {
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='半顺'){
	 		$arr = array($KJJG_1,$KJJG_2,$KJJG_3);
	 		sort($arr);
	 		if($arr[2]-$arr[1]==1 || $arr[1]-$arr[0]==1){
	 			
	 				$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='杂六'){
	 		if($KJJG_1 != $KJJG_2 || $KJJG_1 != $KJJG_3 || $KJJG_2 != $KJJG_3){
	 			$arr = array($KJJG_1,$KJJG_2,$KJJG_3);
	 			sort($arr);
	 			if($arr[2]-$arr[1] != 1 || $arr[1]-$arr[0] != 1){
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	
	 }
	 if($wanfaname['class_name_mini'] == "特殊号中三"){
	 	if($OLD_TZ['tzhm']=='对子'){
	 		if($KJJG_4 == $KJJG_2 || $KJJG_4 == $KJJG_3 || $KJJG_2 == $KJJG_3){
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='豹子'){
	 		if($KJJG_4 == $KJJG_2 && $KJJG_4 == $KJJG_3 && $KJJG_2 == $KJJG_3){
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='顺子'){
	 		$arr = array($KJJG_4,$KJJG_2,$KJJG_3);
	 		sort($arr);
	 		if($arr[2]-$arr[1]==1){
	 			if ($arr[1]-$arr[0]==1) {
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='半顺'){
	 		$arr = array($KJJG_4,$KJJG_2,$KJJG_3);
	 		sort($arr);
	 		if($arr[2]-$arr[1]==1 || $arr[1]-$arr[0]==1){
	 		 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='杂六'){
	 		if($KJJG_4 != $KJJG_2 || $KJJG_4 != $KJJG_3 || $KJJG_2 != $KJJG_3){
	 			$arr = array($KJJG_4,$KJJG_2,$KJJG_3);
	 			sort($arr);
	 			if($arr[2]-$arr[1] != 1 || $arr[1]-$arr[0] != 1){
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 }
	 if($wanfaname['class_name_mini'] == "特殊号后三"){
	 	if($OLD_TZ['tzhm']=='对子'){
	 		if($KJJG_4 == $KJJG_5 || $KJJG_4 == $KJJG_3 || $KJJG_5 == $KJJG_3){
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='豹子'){
	 		if($KJJG_4 == $KJJG_5 && $KJJG_4 == $KJJG_3 && $KJJG_5 == $KJJG_3){
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='顺子'){
	 		$arr = array($KJJG_4,$KJJG_5,$KJJG_3);
	 		sort($arr);
	 		if($arr[2]-$arr[1]==1){
	 			if ($arr[1]-$arr[0]==1) {
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='半顺'){
	 		$arr = array($KJJG_4,$KJJG_5,$KJJG_3);
	 		sort($arr);
	 		if($arr[2]-$arr[1]==1 || $arr[1]-$arr[0]==1){
	 	
	 			$ZJZS=$ZJZS+1;
	 		}
	 	}
	 	if($OLD_TZ['tzhm']=='杂六'){
	 		if($KJJG_4 != $KJJG_5 || $KJJG_4 != $KJJG_3 || $KJJG_5 != $KJJG_3){
	 			$arr = array($KJJG_4,$KJJG_5,$KJJG_3);
	 			sort($arr);
	 			if($arr[2]-$arr[1] != 1 || $arr[1]-$arr[0] != 1){
	 				$ZJZS=$ZJZS+1;
	 			}
	 		}
	 	}
	 }

	 IF($wanfaname['class_name_mini']=="定位万位"){
		 
	 	$HMARAY = explode(' ', $OLD_TZ['tzhm']);
	 	 
	 	foreach ($HMARAY as $v){
	 
	 		IF($v=="大" && $KJJG_1>4){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="小" && $KJJG_1<5){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="单" && $KJJG_1%2!=0){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="双" && $KJJG_1%2==0){$ZJZS=$ZJZS+1;}
	 	}
	 }
	 IF($wanfaname['class_name_mini']=="定位千位"){
	 		
	 $HMARAY = explode(' ', $OLD_TZ['tzhm']);
	 	 
	 	foreach ($HMARAY as $v){
	 
	 		IF($v=="大" && $KJJG_2>4){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="小" && $KJJG_2<5){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="单" && $KJJG_2%2!=0){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="双" && $KJJG_2%2==0){$ZJZS=$ZJZS+1;}
	 	}
	 }
	 IF($wanfaname['class_name_mini']=="定位百位"){
	 		
	 $HMARAY = explode(' ', $OLD_TZ['tzhm']);
	 	 
	 	foreach ($HMARAY as $v){
	 
	 		IF($v=="大" && $KJJG_3>4){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="小" && $KJJG_3<5){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="单" && $KJJG_3%2!=0){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="双" && $KJJG_3%2==0){$ZJZS=$ZJZS+1;}
	 	}
	 
	 }
	 IF($wanfaname['class_name_mini']=="定位十位"){
	 	 
	 	$HMARAY = explode(' ', $OLD_TZ['tzhm']);
	 	 
	 	foreach ($HMARAY as $v){
	 
	 		IF($v=="大" && $KJJG_4>4){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="小" && $KJJG_4<5){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="单" && $KJJG_4%2!=0){$ZJZS=$ZJZS+1;}
	 		 
	 		IF($v=="双" && $KJJG_4%2==0){$ZJZS=$ZJZS+1;}
	 	}
	 
	 }
	 IF($wanfaname['class_name_mini']=="定位个位"){
	 	
	 	$HMARAY = explode(' ', $OLD_TZ['tzhm']);
	 	
	 	foreach ($HMARAY as $v){
	 		
		 	IF($v=="大" && $KJJG_5>4){$ZJZS=$ZJZS+1;}
		 		
		 	IF($v=="小" && $KJJG_5<5){$ZJZS=$ZJZS+1;}
		 		
		 	IF($v=="单" && $KJJG_5%2!=0){$ZJZS=$ZJZS+1;}
		 		
		 	IF($v=="双" && $KJJG_5%2==0){$ZJZS=$ZJZS+1;}
	 	}
	 		
	 }
	 IF($wanfaname['class_name_mini']=="大小单双总和"){
	 	$HMARAY = explode(' ', $OLD_TZ['tzhm']);
	 	$KJZH = $KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
	 	foreach ($HMARAY as $v){
	 		IF($v=="大" && $KJZH>22){$ZJZS=$ZJZS+1;}
	 		
	 		IF($v=="小" && $KJZH<23){$ZJZS=$ZJZS+1;}
	 		
	 		IF($v=="单" && $KJZH%2!=0){$ZJZS=$ZJZS+1;}
	 		
	 		IF($v=="双" && $KJZH%2==0){$ZJZS=$ZJZS+1;}
	 	}
	 		
	 }
	 IF($wanfaname['class_name_mini']=="大小单双串关"){
	 	$HMARAY = explode(',', $OLD_TZ['tzhm']);
	 	
	 	foreach ($HMARAY as $k=>$v){
	 		$i = $k+1;
	 		$vali = explode(' ', $v);
	 		foreach ($vali as $va){
		 		IF($va=="大" && '$KJJG_'.$i>4){$ZJZS=$ZJZS+1;}
		 
		 		IF($va=="小" && '$KJJG_'.$i<5){$ZJZS=$ZJZS+1;}
		 
		 		IF($va=="单" && '$KJJG_'.$i%2!=0){$ZJZS=$ZJZS+1;}
		 
		 		IF($va=="双" && '$KJJG_'.$i%2==0){$ZJZS=$ZJZS+1;}
	 		}
	 	}
	 
	 }
	 
	 IF($wanfaname['class_name_mini']=="斗牛"){
		 
		 IF($OLD_TZ['tzhm']=="无牛"){
			 
			 $IFWUNIU=0;
			 
			 FOR($N_1=0;$N_1<5;$N_1++){
				 
				 FOR($N_2=0;$N_2<5;$N_2++){
					 
					 FOR($N_3=0;$N_3<5;$N_3++){
						 
						 IF($IFWUNIU==0){
							 
							 IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
								 
								 $A_1=SUBSTR($KJJG,$N_1,1);
						 
								 $A_2=SUBSTR($KJJG,$N_2,1);
								 
								 $A_3=SUBSTR($KJJG,$N_3,1);
								 
								 $ZHS=$A_1+$A_2+$A_3;
								 
								 IF($ZHS%10==0){
									 
									 $IFWUNIU=1;
									 
								 }
							 } 	
						 } 
					 }
				 }
				 
			 }
			 
			 IF($IFWUNIU==0){$ZJZS=$ZJZS+1;}
			 
		 }
		 IF($OLD_TZ['tzhm']=="牛一"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==1){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛二"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==2){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛三"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==3){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛四"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==4){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛五"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==5){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛六"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==6){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛七"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==7){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛八"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==8){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛九"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==9){$ZJZS=$ZJZS+1;}
		 	}
		 }
		 IF($OLD_TZ['tzhm']=="牛牛"){
		 	$IFWUNIU=0;
		 	FOR($N_1=0;$N_1<5;$N_1++){
		 		FOR($N_2=0;$N_2<5;$N_2++){
		 			FOR($N_3=0;$N_3<5;$N_3++){
		 				IF($IFWUNIU==0){
		 					IF($N_1!=$N_2 && $N_1!=$N_3 && $N_2!=$N_3){
		 						$A_1=SUBSTR($KJJG,$N_1,1);
		 						$A_2=SUBSTR($KJJG,$N_2,1);
		 						$A_3=SUBSTR($KJJG,$N_3,1);
		 						$ZHS=$A_1+$A_2+$A_3;
		 						IF($ZHS%10==0){
		 							$IFWUNIU=1;
		 						}
		 					}
		 				}
		 			}
		 		}
		 	}
		 	if($IFWUNIU) {
		 		$ZHONGHEZHI=$KJJG_1+$KJJG_2+$KJJG_3+$KJJG_4+$KJJG_5;
		 		$ZHONGHEZHI=FLOOR($ZHONGHEZHI-$ZHS);
		 		IF($ZHONGHEZHI>=10){$ZHONGHEZHI=$ZHONGHEZHI-10;}
		 		IF($ZHONGHEZHI==0){$ZJZS=$ZJZS+1;}
		 	}
		 }
	 }
	 

	 //结算中奖金额并且删除投注数据表转移到已结算表
	 
	 //定义试玩账号和内部账号  区分写入表
	 
	 $USER_CL=$db_pdo_link->query("SELECT * FROM kkty_username WHERE username='".$OLD_TZ['username']."'")->fetch(PDO::FETCH_ASSOC);
	 
	 IF($USER_CL['nbzh']==1 || $USER_CL['swzh']==1){
		 
		 $MYSQL_NAME="kkty_touzhu_list_sw";
		 
	 }ELSE{
		 
		 $MYSQL_NAME="kkty_touzhu_list_ok";
		 
	 }
	 
	 //取出中奖金额
	 
	 IF($OLD_TZ['nbzh']==1){$TZMS_LH=1;}
	 
	 IF($OLD_TZ['nbzh']==2){$TZMS_LH=10;}
	 
	 IF($OLD_TZ['nbzh']==3){$TZMS_LH=100;}
	 
	 //中奖金额算法注释   投注赔率 除以2 乘以单注金额 乘以 中奖注数 除以 投注模式 （赔率*单注金额*中奖注数/投注模式）
	 $ZJJE=$OLD_TZ['dqpl']*$OLD_TZ['dzje']*$ZJZS/$TZMS_LH;
	 if($wanfaname['class_name_mini']=="五星直选组合"){
	 	$pl = explode('|', $OLD_TZ['dqpl']);
	 	if($ZJZS==5){$ZJJE=($pl[0]+$pl[1]+$pl[2]+$pl[3]+$pl[4])*$OLD_TZ['dzje']/$TZMS_LH;}
	 	if($ZJZS==4){$ZJJE=($pl[1]+$pl[2]+$pl[3]+$pl[4])*$OLD_TZ['dzje']/$TZMS_LH;}
	 	if($ZJZS==3){$ZJJE=($pl[2]+$pl[3]+$pl[4])*$OLD_TZ['dzje']/$TZMS_LH;}
	 	if($ZJZS==2){$ZJJE=($pl[3]+$pl[4])*$OLD_TZ['dzje']/$TZMS_LH;}
	 	if($ZJZS==1){$ZJJE=$pl[4]*$OLD_TZ['dzje']/$TZMS_LH;}
	 }
	 if($wanfaname['class_name_mini']=="前四直选组合" || $wanfaname['class_name_mini']=="后四直选组合"){
	 	$pl = explode('|', $OLD_TZ['dqpl']);
	 	if($ZJZS==4){$ZJJE=($pl[0]+$pl[1]+$pl[2]+$pl[3])*$OLD_TZ['dzje']/$TZMS_LH;}
	 	if($ZJZS==3){$ZJJE=($pl[1]+$pl[2]+$pl[3])*$OLD_TZ['dzje']/$TZMS_LH;}
	 	if($ZJZS==2){$ZJJE=($pl[2]+$pl[3])*$OLD_TZ['dzje']/$TZMS_LH;}
	 	if($ZJZS==1){$ZJJE=($pl[3])*$OLD_TZ['dzje']/$TZMS_LH;}
	 }
	
	
	 //转移投注注单
	 
	 $MYSQL_ZHIXING_YUJU_A="`czid`,`qihao`,`tzhm`,`tzje`,`dzje`,`tzzs`,`username`,`tzhje`,`zjje`,`ifqs`,`wfid`,`dqpl`,`xzfd`,`fdje`,`kjjg`,`zjzs`,`nbzh`,`tz_time`";
	 
	 $MYSQL_ZHIXING_YUJU_B="'".$OLD_TZ['czid']."','".$OLD_TZ['qihao']."','".$OLD_TZ['tzhm']."','".$OLD_TZ['tzje']."','".$OLD_TZ['dzje']."','".$OLD_TZ['tzzs']."','".$OLD_TZ['username']."','".$OLD_TZ['tzhje']."','{$ZJJE}','1','".$OLD_TZ['wfid']."','".$OLD_TZ['dqpl']."','".$OLD_TZ['xzfd']."','".$OLD_TZ['fdje']."','{$KJJG}','{$ZJZS}','".$OLD_TZ['nbzh']."','".$OLD_TZ['tz_time']."'";
	 
	 
	  try{ 
		$db_pdo_link->beginTransaction(); 
		$db_pdo_link->exec("INSERT INTO `{$MYSQL_NAME}` ($MYSQL_ZHIXING_YUJU_A) VALUES ($MYSQL_ZHIXING_YUJU_B)");
	 
		$db_pdo_link->exec("DELETE FROM `kkty_touzhu_list_no` WHERE id={$TZID}");
		 
		//判断中奖金额大于0.001 大于的话给用户增加金额
		 
		IF($ZJJE>0.001)
		{
			 
			$db_pdo_link->exec("UPDATE kkty_username SET `je`=`je` + '{$ZJJE}' WHERE id={$USER_CL['id']}");	
		}
		//发送消息
		$CZNMSD=$db_pdo_link->query("SELECT * FROM kkty_caipai_list WHERE id={$OLD_TZ['czid']}")->fetch(PDO::FETCH_ASSOC);
		 
		IF($CZNMSD['cp_name_new']==""){$CZNMSD['cp_name_new']=$CZNMSD['cp_name_old'];}
		 
		USER_FASONG($USER_CL['username'],"您投注的彩种：【{$CZNMSD['cp_name_new']}】第：【{$OLD_TZ['qihao']}】已开奖，中奖金额：【{$ZJJE}】元！");
		
		$db_pdo_link->commit(); 
		return true;
	 }catch(PDOException $e)
	 {
		$db_pdo_link->rollBack();
		return false;
	 } 
}

FUNCTION NumFromDesc($n1,$n2,$n3){

    if($n1==0)
        $n1=10;
    if($n2==0)
        $n2=10;
    if($n3==0)
        $n3=10;
    $nums = array($n1,$n2,$n3);

    sort($nums);

    $nfd="杂六";
    $isbs=false;
    $isdz=false;
    for($i=0;$i<3;$i++){
        $t1 = $nums[$i];


        if ($i == 2) {
            $t2 = $nums[0];
        } else {
            $t2 = $nums[$i + 1];
        }
        if ($t1 == $t2) {
            if ($isdz) {
                $nfd = "豹子";
                break;
            }
            $isdz = true;
            $nfd = "对子";
        } elseif (!$isdz && ($t1 - $t2 == 1 || $t1 - $t2 == -1 || $t1 - $t2 == 9 || $t1 - $t2 == -9)) {// 判断半顺
            if ($isbs
            && ($nums[2] - $nums[0] == 2 || $nums[2] - $nums[0] == -2
                    || $nums[2] - $nums[0] == 9 || $nums[2] - $nums[0] == -9)) {// 判断顺子
                $nfd = "顺子";
                break;
            }
            $isbs = true;
            $nfd = "半顺";
        }
    }
    return $nfd;
}
//-------------------------------------------时时彩彩种类结算----------------------------------------------------------//


//---------------------代理提成结算----------------------------------------------------

/**
 ** $USER [string 投注的会员名字]
 ** $TZJE [string 投注的金额]
 ** $DL [string 是否是代理]
**/

FUNCTION DAILIJIESUAN($USER,$true_je,$QIHAO,$czid,$xjrens='xjrens>=0',$consumer=''){
    
	echo '';

} 
//---------------------代理提成结算----------------------------------------------------


//会员消息发送
FUNCTION USER_FASONG($USER,$TEST){
	 
	 GLOBAL $db_pdo_link;
	 
	 $TIMES=TIME();
	 
	 $MYSQL_ZIDUAN="`username`,`test`,`xx_time`,`ifdq`";
	 
	 $MYSQL_NEIRON="'{$USER}','{$TEST}','{$TIMES}','0'";
	 
	 $db_pdo_link->exec("INSERT INTO `kkty_xiaoxi` ($MYSQL_ZIDUAN) VALUES ($MYSQL_NEIRON)");
	 
}


$OVERTIME=TIME();

$HDSHHD=$OVERTIME-$OPENTIME;

ECHO RAND(1000,99999)."</BR>".$HDSHHD;


?>
